package com.androidhive.musicplayer;
  
import android.os.Bundle; 
import android.app.Activity; 
import android.content.Intent; 
import android.view.View;
import android.widget.Button;
import android.widget.EditText; 

public class FileexplorerActivity extends Activity {
 
	private static final int REQUEST_PATH = 1;
 
	String curFileName;
	
	EditText edittext;
	EditText name;
	public static String address = "";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		 super.onCreate(savedInstanceState);
	        setContentView(R.layout.activity_fileexplorer); 
	        		
		
		edittext = (EditText) findViewById(R.id.editText);
		
		Button btnNextScreen = (Button) findViewById(R.id.btnNextScreen);
		
		//Listening to button event
		btnNextScreen.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View arg0) {
				//Starting a new Intent
				FileexplorerActivity.address = edittext.getText().toString();
				Intent nextScreen = new Intent(getApplicationContext(), AndroidBuildingMusicPlayerActivity.class);
				startActivity(nextScreen);
			}
		});
	

    
       
    }
 
    public void getfile(View view){ 
    	Intent intent1 = new Intent(this, FileChooser.class);
        startActivityForResult(intent1,REQUEST_PATH);
    }
 // Listen for results.
    protected void onActivityResult(int requestCode, int resultCode, Intent data){
        // See which child activity is calling us back.
    	if (requestCode == REQUEST_PATH){
    		if (resultCode == RESULT_OK) { 
    			curFileName = data.getStringExtra("GetPath"); 
            	edittext.setText(curFileName);
    		}
    	 }
    }
}
